﻿using H2.NET.Common;
using H2.NET.Web.BI.Model;
using H2.NET.Web.Workflow.DwzCode;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace H2.NET.Web.BI.Template
{
    public partial class Edit : BasePage
    {
        [SessionType]
        public clsCommon clsCmm = new clsCommon();
        public List<bi_DB> DB = new List<bi_DB>();
        public bi_Template template;
        public int id = 0;
        public string cp = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            UltimusMDC3Entities context = new UltimusMDC3Entities();
            id = AksRequest.GetQueryInt("id");
            cp = AksRequest.GetQueryString("cp");
            if (id > 0)
            {
                template = context.bi_Template.Find(id);
                if(clsCmm.comm_username!=template.create_user && string.IsNullOrEmpty(cp))
                {
                    ErrorMsg("对不起，您没有权限修改此模版，请联系模版创建人或复制模版后修改！", "TemplateEdit");
                    return;
                }
            }
            else
            {
                ErrorMsg("对不起，该页无法刷新，请重新点击修改按钮！");
                return;
            }
            DB = context.bi_DB.ToList();
        }
    }
}